//
//  OSUserGuideCell.m
//  OnLineSignApp
//
//  Created by 凯朱 on 2023/10/13.
//

#import "OSUserGuideCell.h"
@interface OSUserGuideCell ()

@property (nonatomic,weak) UIImageView * imageView;
@property (nonatomic,strong) UIButton * startBtn;

@end
@implementation OSUserGuideCell

- (void)setImageUrl:(NSString *)imageUrl{
    _imageUrl = imageUrl;
    self.imageView.image = [UIImage imageNamed:imageUrl];
}
- (void)setShowBtn:(BOOL)showBtn{
    _showBtn = showBtn;
    self.startBtn.hidden = !showBtn;
}

- (instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        [self initViews];
    }return self;
}
- (void)initViews{
    UIImageView * imageView = [[UIImageView alloc] init];
    imageView.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:imageView];
    self.imageView = imageView;
    [imageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.offset(0);
    }];
    [self addStartBtn];
}
- (void)addStartBtn{
    UIButton * btn = [[UIButton alloc] init];
    [self.contentView addSubview:btn];
    [btn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_equalTo(CGSizeMake(200, 44));
        make.bottom.offset(-(0.09*kScreenHeight));
        make.centerX.mas_equalTo(self.contentView.mas_centerX);
    }];
    self.startBtn = btn;
    [btn setTitle:@"立即开启" forState:UIControlStateNormal];
    [btn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    btn.titleLabel.font = [UIFont boldSystemFontOfSize:16];
    btn.backgroundColor = OSColor_B;
    btn.layer.cornerRadius = 3;
    btn.layer.masksToBounds = YES;
    [btn addTarget:self action:@selector(clickedStartBtn) forControlEvents:UIControlEventTouchUpInside];
    btn.hidden = YES;
    [self.contentView bringSubviewToFront:btn];
}
- (void)clickedStartBtn{
    if (self.GuideImageCellBlock)self.GuideImageCellBlock();
}
@end
